import request from '@/network'

// 发布说说
export const createMessageRequest = async (content: string) => {
  const result = await request.post({
    url: '/message/create_message',
    data: {
      content,
    },
  })
  return result
}
// 说说列表
export const queryMessageListRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/message/list',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 搜索
export const searchMessageRequest = async (searchInfo: { [key: string]: any }, currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.post({
    url: '/message/search',
    data: {
      searchInfo,
      currentPage,
      pageSize,
    },
  })
  return result
}
// 更新说说内容
export const updateMessageContentRequest = async (message_id: number, content: string) => {
  const result = await request.patch({
    url: '/message/update_content',
    data: {
      message_id,
      content,
    },
  })
  return result
}
// 删除说说
export const deleteMessageRequest = async (message_id: number) => {
  const result = await request.delete({
    url: '/message/delete_message',
    data: {
      message_id,
    },
  })
  return result
}
